package org.opsli.modulars.shop.common;

import lombok.extern.slf4j.Slf4j;
import org.opsli.api.web.shop.common.SysShopCommonRestApi;
import org.opsli.api.web.shop.device.SysShopDeviceRestApi;
import org.opsli.api.web.shop.userorder.SysUserOrderRestApi;
import org.opsli.api.wrapper.shop.device.SysShopDeviceModel;
import org.opsli.api.wrapper.shop.userorder.SysUserOrderModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;
@Slf4j
@Component
public class OrderAndDeviceService implements SysShopCommonRestApi {

    @Autowired
    SysShopDeviceRestApi sysShopDeviceRestApi;
    @Autowired
    SysUserOrderRestApi sysUserOrderRestApi;

    @Override
    public List<SysUserOrderModel> getListByDate(Date date, String orgIds, String deviceId){
        return sysUserOrderRestApi.getListByDate(date,orgIds,deviceId);
    }
    @Override
    public SysShopDeviceModel getSysShopDeviceModelById(String id){
        SysShopDeviceModel sysShopDeviceModel = new   SysShopDeviceModel();
        sysShopDeviceModel.setId(id);
        return sysShopDeviceRestApi.get(sysShopDeviceModel).getData();
    }
}
